Working out the bugs in my new object that implements assembly bias in a continuous way.
In [1]:
from pearce.mocks.kittens import cat_dict
import numpy as np
from scipy.stats import binned_statistic, linregress
In [2]:
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
In [3]:
sns.set_context("notebook", font_scale=1.5, rc={"lines.linewidth": 2.5})
In [4]:
cosmo_params = {'simname':'chinchilla', 'Lbox':400.0, 'scale_factors':[0.658, 1.0]}
In [5]:
cat = cat_dict[cosmo_params['simname']](**cosmo_params)#construct the specified catalog!
In [6]:
cat.load(1.0, HOD='redMagic')#, hod_kwargs = {'sec_haloprop_key':'halo_log_nfw_conc'})#, hod_kwargs={'split': 0.5})
In [7]:
cat.model.param_dict
Out[7]:
In [8]:
fiducial_point = {'logM0': 12.20, 'logM1': 13.7, 'alpha': 1.02,
'logMmin': 12.1, 'f_c': 0.19, 'sigma_logM': 0.46}
In [9]:
rp_bins = np.logspace(-1,1.25,15)
pi_max = 40
In [10]:
hod_params = dict(fiducial_point)
In [11]:
n_pops = 2000
wp_vals = np.zeros((n_pops, rp_bins.shape[0]-1))
for i in xrange(n_pops):
if i%10==0:
print i
cat.populate(hod_params)
wp_vals[i,:] = cat.calc_wp(rp_bins, pi_max, n_cores = 1)
In [12]:
sns.set_style("darkgrid", {"axes.facecolor": "0.85"})
In [13]:
rbc = (rp_bins[1:]+rp_bins[:-1])/2
In [14]:
print rbc
In [15]:
from scipy.stats import normaltest, skewtest, kurtosistest
for i in xrange(wp_vals.shape[1]):
plt.hist(np.log10(wp_vals[:,i]), bins = int(np.ceil(np.sqrt(1000)) ));
stat, p = normaltest(np.log10(wp_vals[:,i]) )
z, ps = skewtest(np.log10(wp_vals[:,i]))
z, pk = kurtosistest(np.log10(wp_vals[:,i]))
plt.title(r"$r = %.2f\; $Mpc$ \;\; p=%.2f,%.2f,%.2f $"%(rbc[i], p, ps, pk) )
plt.show()
In [16]:
sat, p = normaltest(np.log10(wp_vals))
print p
In [ ]: